package cn.edu.jou.cs.course.springboot.addersim;

public enum Signal {
    ZERO(0), ONE(1);
    private int value;
    Signal(int value) {
        this.value = value;
    }

    public static Signal valueOf(int signal) {
        if (signal < 0 || signal > 1) {
            throw new IllegalArgumentException("Bad signal: " + signal);
        }
        if (signal == 0) return ZERO;
        return ONE;
    }

    public int getValue() {
        return value;
    }
}
